package br.edu.ufcg.ga.population;

public class InitialPopulationGeneratorFactory {

	public static InitialPopulationGenerator getInitialPopulationGenerator(String typeString) {

		InitialPopulationGeneratorEnum type = null;

		try {
			type = InitialPopulationGeneratorEnum.valueOf(typeString);
		} catch (IllegalArgumentException iae) {
			throw new RuntimeException("Unknown Initial Population Generator: <" + typeString + ">");
		}

		switch (type) {
		case RANDOM:
			return new RandomInitialPopulationGenerator();
		case SIMPLE:
			return new SimplePopulationGenerator();
		default:
			throw new RuntimeException("Unknown Initial Population Generator: <" + type + ">");
		}
	}

}
